package com.nbsaas.boot.area.rest.convert;

import com.nbsaas.boot.area.data.entity.AreaHot;
import com.nbsaas.boot.area.api.domain.simple.AreaHotSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
 * 热门地区-列表对象转换器
 */

public class AreaHotSimpleConvert implements Converter<AreaHotSimple, AreaHot> {


    @Override
    public AreaHotSimple convert(AreaHot source) {
        AreaHotSimple result = new AreaHotSimple();


        try {
            if (source.getArea() != null) {
                result.setArea(source.getArea().getId());
            }
        } catch (Exception ignored) {
        }


        try {
            if (source.getArea() != null) {
                result.setAreaName(source.getArea().getName());
            }
        } catch (Exception ignored) {
        }

        result.setSortNum(source.getSortNum());
        result.setId(source.getId());
        result.setAddDate(source.getAddDate());
        result.setLastDate(source.getLastDate());


        return result;
    }

}